﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleRest.Serialization
{
    /// <summary>
    /// Not yet implemented.
    /// </summary>
    public class WsdlSerializer
    {
        private readonly XsdSerializer XsdSerializer = new XsdSerializer();

        public string Serialize(Type serviceClassType, string serviceName, string serviceNamespace = "http://tempuri.org/")
        {
            if (!serviceClassType.IsClass)
                throw new Exception("Can only generate Wsdl's from classes.  Make sure the type specified is a class.");

            StringBuilder sb = new StringBuilder();
            sb.Append(@"<wsdl:definitions xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/"" ");
            sb.Append(@"xmlns:soap=""http://schemas.xmlsoap.org/wsdl/soap/"" ");
            sb.Append(@"xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/"" ");
            sb.Append(@"xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"" ");
            sb.Append(@"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "); 
            sb.Append(@"xmlns:soap12=""http://schemas.xmlsoap.org/wsdl/soap12/"" "); 
            sb.Append(@"xmlns:tns=""http://tempuri.org/"" ");
            sb.Append(@"xmlns:wsa=""http://schemas.xmlsoap.org/ws/2004/08/addressing"" ");
            sb.Append(@"xmlns:wsp=""http://schemas.xmlsoap.org/ws/2004/09/policy"" "); 
            sb.Append(@"xmlns:wsap=""http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"" "); 
            sb.Append(@"xmlns:wsaw=""http://www.w3.org/2006/05/addressing/wsdl"" "); 
            sb.Append(@"xmlns:msc=""http://schemas.microsoft.com/ws/2005/12/wsdl/contract"" "); 
            sb.Append(@"xmlns:wsa10=""http://www.w3.org/2005/08/addressing"" ");
            sb.Append(@"xmlns:wsx=""http://schemas.xmlsoap.org/ws/2004/09/mex"" "); 
            sb.Append(@"xmlns:wsam=""http://www.w3.org/2007/05/addressing/metadata"" "); 
            sb.Append(@"name=""" + serviceName + @""" ");
            sb.Append(@"targetNamespace=""" + serviceNamespace + @""">\n");
            sb.Append(@"<wsdl:types>\n");
            sb.Append(@"{Insert Xsd Here}\n");
            sb.Append(@"</wsdl:types>");

            throw new NotImplementedException();
        }
    }
}
